ADFS technical Information

A disc formatted for use with the Advanced Disc Filing System will be either.
single-sided in which case it will contain either 40 or 80 tracks, each divided into 16
sectors containing 256 bytes.

- double-sided
in which case it will contain 2 x 80 = 160 tracks, each divided into 16 sectors
containing 256 bytes. (The two surfaces are considered to be a single entity).

A given sector may therefore be identified by means of either its track and
sector number or by means of its 'absolute' sector number (ie 16*<track
number> + <sector number on track> . Absolute sector numbers are used
throughout this section.

Files stored by the Advanced Disc Filing System are merely sequences of bytes
which always begin at the start of a sector and extend for the number of
(complete) sectors necessary to accommodate the data contained on the file (ie
there may be a number of 'unused' bytes at the end of the last sector allocated
to the file) The last 'data' byte in the file is derived from the file length stored in
the catalogue entry for the file (see below).

Unlike the Disc Filing System ( in which the areas of free space are derived from
the catalogue entries for each file), the Advanced Disc Filing System maintains
a map of the free space (and other information) in sectors 0 and 1 of each disc.
Sectors 2 to 6 inclusive always contain the information relating to the root
director, y and the remaining sectors contain either inf ormation relating to files
and subordinate directories or the actual content of files

Note Since track 0 is the outermost track on both 40- and 80-track discs, it is
possible to access both the Free Space Map and the information relating to the
root directory of both types of disc in either type of drive. The same is true for
any files or directories which can be guaranteed to exist solely on track 0 (sector
numbers 0 15), although this facility should be used with caution.
A reference to an absolute sector number is always represented by a 3-byte
value

The Free Space Map

The Free Space Map is stored in sectors 0 and 1 on each drive. The format
being:

Sector 0

Bytes Content

0 - 2 Start sector of first free space
3 - 5 Start sector of second free space
6 - 8 Start sector of third free space

. Repeated for 82 free space entries

246 Reserved
247 Reserved
248 Reserved
249 Reserved
250 Reserved
251 Reserved
252 LSB of total number of sectors on disc
253                 .
254 MSB of total number of sectors on disc
255 Checksum on free space map, sector 0

Sector 1

Bytes Content

0 - 2 Length of first free space (in sectors)
3 - 5 Length of second free space
6 - 8 Length of third free space

Repeated for 82 free space entries

246 Reserved
247 Reserved
248 Reserved
249 Reserved
250 Reserved
251 2  252 Disc identifier
253 Boot option number ( as set by *OPT4 )
254 Pointer to end of free space list
255 Checksum on free space map, sector 1



Directory information

A directory consists of five contiguous sectors on the disc - the root directory is
always located on track 0 (sectors 2 - 6). The information relating to the
current directory is always resident in the area of RAM reserved for use by the
MOS/Filing Systems.

Note that whereas the Disc Filing System uses 18-bit addresses, all addresses
held by the Advanced Disc Filing System are 32 bits (4 bytes) in length.

The format for each directory is shown below .

Bytes Content

0 Directory Master Sequence Number (in binary coded decimal)
1 - 4 Fixed string identifying the sector as the start of a directory
5 - 14 Name and access string for first directory entry (see note)
15 - 18 Load address for first directory entry
19 - 22 Execution address for first directory entry
23 - 26 Length of first directory entry in bytes
27 - 29 Start sector for first directory entry
30 Sequence number for first directory entry (see note)
31 - 40 Name and access string for second directory entry
41 - 44 Load address for second directory entry
45 -  48 Execution address for second directory entry
49 -  52 Length of second directory entry in bytes
53 -  55 Start sector for second directory entry
56 Sequence number for second directory entry

. . Repeated for 47 directory entries

1227 0
1228 - 1237 Directory name/access string
1238 - 1240 Start sector of parent directory
1241 -1259 Directory title
1260 - 1273  Reserved
1274 Directory Master Sequence Number (in binary coded decimal)
1275 - 1278 Fixed string identifying a directory
1279 0



Notes
A directory can take a maximum of 47 entries - if there are less than 47 , this is
indicated by the entry after the last file having a name string starting with
&00. Directory entries are held in alphabetical order.
File and directory attributes are stored in the top bit of the first four bytes of
the name/access string string:

1st byte bit 7 set/ clear indicates R attribute set/not set
2nd byte bit 7 set/clear indicates W attribute set/not set
3rd byte bit 7 set/clear indicates L attribute set/not set
4th byte bit 7 set indicates that the entry is a directory
 bit 7 clear indicates that the entry is a file

CJR's bit here!   5th Byte= E attribute >128 are set

If a string is shorter than the space reserved for it, the string ends with a &0D
and the remaining bytes are not significant.

Each directory has a two-byte master sequence number , held in binary coded
decimal format. This value is set to zero when the directory is created.
The master sequence number is incremented every time a change is made to
the content of the directory catalogue and the new value is assigned to the
sequence number associated with the new/changed directory entry. The
sequence number for each directory entry (as displayed by *CAT ) may therefore
be used to assess the 'age' of each file.
